import http from '../utils/http'
import type { UserInfo } from '@/model/user'
//注册
export const useRegister=(username:string,password:string)=>{
	return	http.post('/users',{
		username,
		password
	})
}
//登录
export const useLogin=(username:string,password:string)=>{
	return	http.post('/login',{
		username,
		password
	})
}
//账号信息更新
//账户id，header,更新信息的数据包userData
type UData = 'avatar'|'autograph'|'name'
export const userUpdate = (objectId:string ,
session:string,userData:Partial<Pick<UserInfo,UData>>)=>{
	return http.put(`/users/${objectId}`,userData,{
		header:{
			"X-LC-Session":session 
		}
	})
}